﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	mc:Ignorable="d"
	xmlns:SampleData="clr-namespace:Expression.Blend.SampleData.LoadDesignData"
    xmlns:System="clr-namespace:System;assembly=mscorlib"
    xmlns:input="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:ic="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions"
	xmlns:Behaviors="clr-namespace:Behaviors;assembly=Behaviors"
	x:Class="System8ToyMC.SaveLoad"
	d:DesignWidth="640" d:DesignHeight="480">

	<UserControl.Resources>
		<SampleData:LoadDesignData x:Key="LoadDesignData" d:IsDataSource="True"/>
	</UserControl.Resources>

	<Grid x:Name="LayoutRoot" d:DataContext="{Binding Source={StaticResource LoadDesignData}}">
		<VisualStateManager.VisualStateGroups>
			<VisualStateGroup x:Name="LoadSaveButtonState">
				<VisualState x:Name="SaveLoadActive">
					<Storyboard>
						<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="SaveButton" Storyboard.TargetProperty="(Control.IsEnabled)">
							<DiscreteObjectKeyFrame KeyTime="00:00:00">
								<DiscreteObjectKeyFrame.Value>
									<System:Boolean>True</System:Boolean>
								</DiscreteObjectKeyFrame.Value>
							</DiscreteObjectKeyFrame>
						</ObjectAnimationUsingKeyFrames>
						<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="LoadButton" Storyboard.TargetProperty="(Control.IsEnabled)">
							<DiscreteObjectKeyFrame KeyTime="00:00:00">
								<DiscreteObjectKeyFrame.Value>
									<System:Boolean>True</System:Boolean>
								</DiscreteObjectKeyFrame.Value>
							</DiscreteObjectKeyFrame>
						</ObjectAnimationUsingKeyFrames>
					</Storyboard>
				</VisualState>
				<VisualState x:Name="SaveLoadInactive">
					<Storyboard>
						<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="SaveButton" Storyboard.TargetProperty="(Control.IsEnabled)">
							<DiscreteObjectKeyFrame KeyTime="00:00:00">
								<DiscreteObjectKeyFrame.Value>
									<System:Boolean>False</System:Boolean>
								</DiscreteObjectKeyFrame.Value>
							</DiscreteObjectKeyFrame>
						</ObjectAnimationUsingKeyFrames>
						<ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="LoadButton" Storyboard.TargetProperty="(Control.IsEnabled)">
							<DiscreteObjectKeyFrame KeyTime="00:00:00">
								<DiscreteObjectKeyFrame.Value>
									<System:Boolean>False</System:Boolean>
								</DiscreteObjectKeyFrame.Value>
							</DiscreteObjectKeyFrame>
						</ObjectAnimationUsingKeyFrames>
					</Storyboard>
				</VisualState>
			</VisualStateGroup>
		</VisualStateManager.VisualStateGroups>
		<Button x:Name="LoadButton" HorizontalAlignment="Left" Margin="79,0,0,0" VerticalAlignment="Top" Width="75" Content="Load" Click="DoLoad" IsEnabled="False"/>
		<Button x:Name="SaveButton" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75" Content="Save" Click="DoSave" IsEnabled="False">
		</Button>
		<input:AutoCompleteBox x:Name="DatasetName" HorizontalAlignment="Left" Margin="34,26,0,0" VerticalAlignment="Top" Width="120" ToolTipService.ToolTip="Enter the name to save or load the numbers from" FilterMode="Contains" IsDropDownOpen="True" IsTextCompletionEnabled="True" ItemsSource="{Binding SavedNames}" MinimumPopulateDelay="20">
			<i:Interaction.Triggers>
				<Behaviors:AutocompleteEmptyTrigger>
					<ic:GoToStateAction StateName="SaveLoadInactive"/>
				</Behaviors:AutocompleteEmptyTrigger>
				<Behaviors:AutocompleteNotEmptyTrigger>
					<ic:GoToStateAction StateName="SaveLoadActive"/>
				</Behaviors:AutocompleteNotEmptyTrigger>
			</i:Interaction.Triggers>
		</input:AutoCompleteBox>
	</Grid>
</UserControl>